#include <iostream>
#include <cmath>
using namespace std;
bool is_prime(int x)
{
    if (x == 0 || x == 1)
        return false;
    int k = sqrt(x);
    for (int i = 2; i <= k; ++i)
    {
        if (x % i == 0)
            return false;
    }
    return true;
}

int main()
{
    int n, tmp;
    cin >> n;
    while (n--)
    {
        cin >> tmp;
        if (is_prime(tmp))
            cout << "Yes" << endl;
        else
            cout << "No\n";
    }
    return 0;
}
